#include <iostream>

using namespace std;

class Solution {
public:
    int maxNumberOfBalloons(string text) {
        int sum[5] = {0, 0, 0, 0, 0};
        for (char character: text) {
            switch (character) {
                case 'b':
                    sum[0]++;
                    break;
                case 'a':
                    sum[1]++;
                    break;
                case 'l':
                    sum[2]++;
                    break;
                case 'o':
                    sum[3]++;
                    break;
                case 'n':
                    sum[4]++;
                    break;
                default:
                    break;
            }
        }
        int count_1 = min(sum[0], sum[1]);
        int count_2 = min(sum[2], sum[3]) / 2;
        int count = min(count_1, count_2);
        count = min(count, sum[4]);
        return count;
    }
};


int main() {
    Solution solution;
    string input = "loonbalxballpoon";
    int out = solution.maxNumberOfBalloons(input);
    cout << out << endl;
}